package com.southminority.ethnic.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 分享信息视图对象
 * 
 * @author SouthMinority
 */
@Data
@Schema(description = "分享信息")
public class ShareInfoVO {

    @Schema(description = "文档ID")
    private Long documentId;

    @Schema(description = "文档标题")
    private String title;

    @Schema(description = "文档描述")
    private String description;

    @Schema(description = "封面图片")
    private String coverImage;

    @Schema(description = "分享链接")
    private String shareUrl;

    @Schema(description = "二维码链接")
    private String qrCodeUrl;

    @Schema(description = "分享文本")
    private String shareText;

    @Schema(description = "分享时间")
    private LocalDateTime shareTime;

    @Schema(description = "分享有效期（小时）")
    private Integer validHours;

    @Schema(description = "是否需要验证码")
    private Boolean needVerification;

    /**
     * 构建分享文本
     */
    public String buildShareText() {
        return String.format("【%s】%s - 南方少数民族语言文化资源平台 %s", 
            this.title, 
            this.description != null && this.description.length() > 50 
                ? this.description.substring(0, 50) + "..." 
                : this.description,
            this.shareUrl);
    }
} 